
// Opens dataset
	global DIR "WRITE YOUR DIRECTORY HERE"
	cd     "$DIR"
	use    cp_nps-0507_append_analysis.dta, clear
	set    matsize 10000

	
//***************************************** Panel: Table 3
	use cp_nps-0507_append_analysis.dta, clear
	areg mtg_attend_any i_c_index female age_dm  educ_any trad_leader, r a(ea_year) cl(ea_year)
	keep if e(sample)==1
	
// Column (1)
	areg mtg_attend_any i_c_index                                   , a(ea_year) cl(ea_year) r
		scalar b1 = _b[i_c_index]
		scalar r1 = e(r2)

// Column (2)
	areg mtg_attend_any i_c_index female age_dm educ_any trad_leader, a(ea_year) cl(ea_year) r
		scalar b2 = _b[i_c_index]
		scalar r2 = e(r2)
	
// Column (3) - Bellows-Miguel (2009) approach
	di b2-((b1-b2)*((.42-r2)/(r2-r1)))
	
// Column (4) - McKenzie
	di b2-((b1-b2)*((.50-r2)/(r2-r1)))
	
// Column (5) - Reliability ratio
	di b2-((b1-b2)*((.80-r2)/(r2-r1)))
	
// Column (6) - Oster (2014)
	di b2-((b1-b2)*((.86-r2)/(r2-r1)))
	
// Column (7) - Most conservative case
	di b2-((b1-b2)*((1-r2)/(r2-r1)))

	
//***************************************** Panel: Table 4
	use cp_nps-0507_append_analysis, clear
	areg g_social i_c_index female age_dm  educ_any trad_leader, robust absorb(ea_year) cluster(ea_year)
	keep if e(sample)==1

// Column (1)
	areg g_social i_c_index                                   , r a(ea_year) cl(ea_year)
		scalar b1 = _b[i_c_index]
		scalar r1 = e(r2)

// Column (2)
	areg g_social i_c_index female age_dm educ_any trad_leader, r a(ea_year) cl(ea_year)
		scalar b2 = _b[i_c_index]
		scalar r2 = e(r2)

// Column (3) - Bellows-Miguel (2009) approach
	di b2-((b1-b2)*((.362-r2)/(r2-r1)))
	
// Column (4) - McKenzie
	di b2-((b1-b2)*((.50-r2)/(r2-r1)))
	
// Column (5) - Reliability ratio
	di b2-((b1-b2)*((.800-r2)/(r2-r1)))
	
// Column (6) - Oster (2014)
	di b2-((b1-b2)*((.759-r2)/(r2-r1)))
	
// Column (7) - Most conservative case
	di b2-((b1-b2)*((1-r2)/(r2-r1)))

	
//***************************************** Panel: Table 5
	use cp_nps-0507_append_analysis, clear
	areg g_political i_c_index female age_dm  educ_any trad_leader, r a(ea_year) cl(ea_year)
	keep if e(sample)==1

// Column (1)
	areg g_political i_c_index                                    , r a(ea_year) cl(ea_year)
		scalar b1 = _b[i_c_index]
		scalar r1 = e(r2)
		
// Column (2)
	areg g_political i_c_index female age_dm  educ_any trad_leader, r a(ea_year) cl(ea_year)
		scalar b2 = _b[i_c_index]
		scalar r2 = e(r2)

// Column (3) - Bellows-Miguel (2009) approach
	di b2-((b1-b2)*((.302-r2)/(r2-r1)))
	
// Column (4) - McKenzie
	di b2-((b1-b2)*((.50-r2)/(r2-r1)))
	
// Column (5) - Reliability ratio
	di b2-((b1-b2)*((.800-r2)/(r2-r1)))
	
// Column (6) - Oster (2014)
	di b2-((b1-b2)*((.636-r2)/(r2-r1)))
	
// Column (7) - Most conservative case
	di b2-((b1-b2)*((1-r2)/(r2-r1)))

